package com.example.lib

import android.app.Application
import android.content.Context
import com.orhanobut.logger.AndroidLogAdapter
import com.orhanobut.logger.FormatStrategy
import com.orhanobut.logger.Logger
import com.orhanobut.logger.PrettyFormatStrategy
import me.jessyan.autosize.AutoSizeConfig

open class LibApp : Application() {

    companion object {
        lateinit var appContext: Context
    }

    override fun onCreate() {
        appContext = applicationContext
        super.onCreate()
        initAutoSize()
        initLog()
    }

    private fun initAutoSize() {
        AutoSizeConfig.getInstance()
    }

    private fun initLog() {
        val formatStrategy: FormatStrategy =
            PrettyFormatStrategy.newBuilder().showThreadInfo(false).methodCount(0).methodOffset(7).tag("yxs").build()

        Logger.addLogAdapter(object : AndroidLogAdapter(formatStrategy) {
        })
    }
}